<!DOCTYPE html>
<html>
	<head>
		<%include ../template/hmeta %>
		<link rel="stylesheet" type="text/css" href="/css/form.css">
		<title>选择收货地址</title>
	</head>	
	<body>
		<!-- header -->
		<header>
			<div class="user-header">
				<a href="javascript:;" class="h-left h-back"><span>返回</span></a>
				<h2>选择收货地址</h2>
				<a href="/" class="h-right h-home"><span>首页</span></a>
			</div>
		</header>

		<div class="box">
			<a href="/user/addAddress?act=select" class="btn btn-info">添加收货地址+</a>
		</div>
		<% if(addressList){ %>
		<div class="box">
			<dl class="address-list">
				<% for(var i=0;i<addressList.length;i++){ var addr = JSON.parse(addressList[i]);%>
				<dd data-id="<%=addr.id%>" class="address-box<%if(addr.id==user.addressID){%> address-selected<%}%>">
					<p><label><%=addr.name%></label><span class="addr-tel"><%=addr.mobilephone%></span></p>
					<p><%=addressMap[addr.province]&&addressMap[addr.province][0]%><%=addressMap[addr.city]&&addressMap[addr.city][0]%><%=addressMap[addr.county]&&addressMap[addr.county][0]%><%=addr.details%></p>
					<div class="addr-oper">
						<a href="/user/editAddress?id=<%=addr.id%>&act=select" class="oper-item oper-edit"><span></span>修改</a>
					</div>
					<%if(addr.id==user.addressID){%> 
						<span class="glyphicon glyphicon-ok"></span>
					<%}%>
				</dd>
				<% } %>
			</dl>
		</div>
		<% } %>

		<!-- modal -->
		<div class="modal fade">
		  <div class="modal-dialog modal-sm">
		    <div class="modal-content">
		      <div class="modal-header">
		        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">关闭</span></button>
		        <h4 class="modal-title">删除提醒</h4>
		      </div>
		      <div class="modal-body">
		        <p>您确定要删除该地址吗？</p>
		      </div>
		      <div class="modal-footer">
		        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
		        <button type="button" class="btn btn-primary">确定</button>
		      </div>
		    </div><!-- /.modal-content -->
		  </div><!-- /.modal-dialog -->
		</div><!-- /.modal -->

		<!-- Footer -->
		<% include ../template/user_footer %>
		<!-- script -->
		<script type="text/javascript">
			require(['umain'],function(main) {
				main.operating();
				main.selectAddress();
			})
		</script>
	</body>
</html>